//
//  ChatTool.m
//  BaiTengIM
//
//  Created by 陈传真 on 2019/7/11.
//  Copyright © 2019 陈传真. All rights reserved.
//

#import "ChatTool.h"

@implementation ChatTool
SingleM(ChatTool);

- (void)requestSeverTime {
    [[NetWorkTool shareInstance] currentTimestampCompleted:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            self.loginSeverTimestamp = [res.rawdata[@"data"] longLongValue];
            self.loginDeltaTimestamp = self.loginSeverTimestamp - [[NSDate date] timeIntervalSince1970] * 1000;
        }
    }];
}

- (long long)currentTimestamp {
    NSTimeInterval timestamp = [[NSDate date] timeIntervalSince1970] * 1000;
    NSTimeInterval result =  timestamp+self.loginDeltaTimestamp;
    return result;
}


@end
